<?php

namespace App\Models\System;

use App\Models\BaseModel;

class Role extends BaseModel
{
    protected $fillable = [
        'title',
        'code',
        'sort',
        'status',
    ];

    protected function casts(): array
    {
        return [
            'created_at' => 'datetime:Y-m-d H:i:s',
            'updated_at' => 'datetime:Y-m-d H:i:s',
        ];
    }

    public function menus()
    {
        return $this->belongsToMany(Menu::class, null, 'role_id', 'menu_id')->withTimestamps();
    }
}
